#ifndef STX_ALGORITHM_FOR_EACH_HPP
#define STX_ALGORITHM_FOR_EACH_HPP

#include <stx/algorithm/common.hpp>

namespace stx {

template <class InputIterator, class Function>
inline Function
for_each(InputIterator first, InputIterator last, Function f)
{
    for (; first != last; ++first) {
        f(*first);
    }
    return f;
}

template<class Container, class Function>
inline Function
for_each(const Container& c,  Function f)
{
    return stx::for_each(stx::begin(c), stx::end(c), f);
}

template <class InputIterator, class Function>
inline Function
for_each(stx::iterator_range<InputIterator> r,  Function f)
{
    return for_each(stx::begin(r), stx::end(r), f);
}

} // namespace stx

#endif // STX_ALGORITHM_FOR_EACH_HPP
